/**
 * Copyright (C) 2017 - 2020 https://github.com/joewee
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.service;

import com.bifrost.entity.Order;
import com.bifrost.entity.OrderStatusHistory;

import java.util.Date;
import java.util.List;

/**
 * 订单状态记录日志服务
 *
 * @author joewee
 * @version 1.0.0
 * @Date 2018/1/5 11:25
 */
public interface OrderStatusHistoryService {
    /**
     * 添加订单状态日志记录
     *
     * @param order
     * @param comments
     * @return
     */
    OrderStatusHistory writeHistory(Order order, String comments);

    /**
     * 添加订单状态记录
     *
     * @param order
     * @return
     */
    OrderStatusHistory writeHistory(Order order);

    /**
     * 添加订单状态记录
     *
     * @param order    订单
     * @param comments 状态描述
     * @param notified 是否已通知客户,为空或为False时则会通知
     * @return
     */
    OrderStatusHistory writeHistory(Order order, String comments, Boolean notified , String code);

    /**
     * 保存记录
     *
     * @param history
     * @return
     */
    OrderStatusHistory save(OrderStatusHistory history);

    /**
     * 查询所有未通知到客户的历史记录
     *
     * @return
     */
    List<OrderStatusHistory> findAllUnnotifiedHistories();

    /**
     * 执行通知
     */
    void notified();

    /**
     * 查询指定订单某状态的操作时间
     * @param orderId
     * @param status
     * @return
     */
    Date getTime(Long orderId, String status);
}
